home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / emstools.arc / EMMLIB.ARC / EMM21_C.ASM < prev    next >
Assembly Source File  |  1990-02-04  |  4KB  |  84 lines

  1. ;-----------------------------------------------------------------------------;
  2. ;      MODULE NAME:   EMM21_C.ASM                                             ;
  3. ;                                                                             ;
  4. ;    FUNCTION NAME:   get_total_handles                                       ;
  5. ;                                                                             ;
  6. ;      DESCRIPTION:   This function returns the total number of handles that  ;
  7. ;                     the memory manager supports, including the operating    ;
  8. ;                     system handle (handle value 0).                         ;
  9. ;                                                                             ;
  10. ;           PASSED:   &max_handle_count:                                      ;
  11. ;                        is a far pointer to the maximum number of handles    ;
  12. ;                        a program may request the memory manager to allocate ;
  13. ;                        memory to.  The value returned includes the          ;
  14. ;                        operating system handle (handle value 0).            ;
  15. ;                                                                             ;
  16. ;         RETURNED:   status:                                                 ;
  17. ;                        is the status EMM returns from the call.  All other  ;
  18. ;                        returned results are valid only if the status        ;
  19. ;                        returned is zero.  Otherwise they are undefined.     ;
  20. ;                                                                             ;
  21. ;                     max_handle_count:                                       ;
  22. ;                        is the maximum number of handles a program may       ;
  23. ;                        request the memory manager to allocate memory to.    ;
  24. ;                        The value returned includes the operating system     ;
  25. ;                        handle (handle value 0).                             ;
  26. ;                                                                             ;
  27. ; C USE CONVENTION:   unsigned int status;                                    ;
  28. ;                     unsigned int max_handle_count;                          ;
  29. ;                                                                             ;
  30. ;                     status = get_total_handles (&max_handle_count);         ;
  31. ;-----------------------------------------------------------------------------;
  32. .XLIST
  33. PAGE    60,132
  34.  
  35. IFDEF SMALL
  36.    .MODEL SMALL, C
  37. ENDIF
  38. IFDEF MEDIUM
  39.    .MODEL MEDIUM, C
  40. ENDIF
  41. IFDEF LARGE
  42.    .MODEL LARGE, C
  43. ENDIF
  44. IFDEF COMPACT
  45.    .MODEL COMPACT, C
  46. ENDIF
  47. IFDEF HUGE
  48.    .MODEL HUGE, C
  49. ENDIF
  50.  
  51. INCLUDE emmlib.equ
  52. INCLUDE emmlib.str
  53. INCLUDE emmlib.mac
  54. .LIST
  55. .CODE
  56.  
  57. get_total_handles    PROC                                                  \
  58.             ptr_handle:FAR PTR WORD
  59.  
  60.     ;---------------------------------------------------------------------;
  61.     ;   do;                                                               ;
  62.     ;   .   get the MAXIMUM number of handles supported by the EMM;       ;
  63.     ;---------------------------------------------------------------------;
  64.     MOVE        AX, get_total_handles_fcn
  65.     INT         EMM_int
  66.  
  67.     ;---------------------------------------------------------------------;
  68.     ;   .   pass the count of the MAXIMUM number of handles supported     ;
  69.     ;   .   by the EMM back to the caller;                                ;
  70.     ;---------------------------------------------------------------------;
  71.     MOVE        DX, BX
  72.     MOVE        ES:BX, ptr_handle
  73.     MOVE        ES:[BX], DX
  74.  
  75.     ;---------------------------------------------------------------------;
  76.     ;   .   return (EMM status);                                          ;
  77.     ;   end;                                                              ;
  78.     ;---------------------------------------------------------------------;
  79.     RET_EMM_STAT    AH
  80.  
  81. get_total_handles    ENDP
  82.  
  83. END
  84.